@import "functions";
@import "colors";

$glowSize: 12px;

* {
  margin: 0;
  padding: 0;
  @include box-sizing();
}

html, body {
  height: 100%;
  overflow: hidden;
}

.preload * {
  -webkit-transition: none !important;
  -moz-transition: none !important;
  -ms-transition: none !important;
  -o-transition: none !important;
}

html {
  background: $pageBackground;
}

@import "typography";
@import "toolbox";
@import "buttons";
@import "codemirror";
@import "chosen";
@import "colorpicker";

//-------------------------------------HEADER
header {
  display: block;
  position: relative;
  padding: 10px 10px 10px 0;
  border-top: 1px solid black;
  border-bottom: 1px solid black;
  @include gradient(#3d3d3e, #2a2a2a);
  @include box-shadow((
    0 1px 0 #3d3d3d,
    inset 0 1px 0 #5a5a5a
  ));
  height: 62px;
  form {
    position: absolute;
    top: 10px;
    left: 20px;
    * {
      vertical-align: middle;
    }
  }
}
.logo {
  a {
    font: 0/0 a;
    background: url(/images/logo.png) no-repeat;
    width: 134px;
    height: 24px;
    display: block;
  }
}

.box-actions {
  display: inline-block;
  margin-left: 20px;
}
#slug {
  border: 0;
  font-size: 16px;
  padding: 1px 3px;
  top: -1px;
  width: 100px;
  position: relative;
  @include font-stack-bold;
  &:focus {
    outline: 0;
  }
}
.app-actions {
  float: right;
  min-width: 260px;
  position: relative;
  .button, button {
    float: right;
  }
}
.user-stuff {
  float: right;
  width: 200px;
  height: 38px;
  text-align: right;
  margin-right: 10px;
  @include font-stack-bold;
  img {
    height: 38px;
    vertical-align: middle;
    @include border-radius(5px);
    float: right;
    margin: 0 0 0 5px;
  }
  a {
    color: #ccc;
    display: block;
    font-size: 18px;
    &.logout-link {
      font-size: 12px;
      color: #999;
    }
  }
}


//------------------------------- SHARING
.sharing-panel {
  position: absolute;
  display: none;
  padding: 10px;
  background: black;
  @include border-radius(10px);
  @include box-shadow((0 0 10px black));
  top: 40px;
  right: 100px;
  z-index: 1005;
  width: 300px;
  label {
    color: white;
    font-size: 11px;
    display: block;
    float: left;
    width: 20%;
  }
  input, textarea {
    width: 80%;
    border: 0;
    resize: none;
    overflow: hidden;
  }
  > div {
    margin: 0 0 8px 0;
  }
  .buttons {
    text-align: center;
    padding-top: 5px;
  }
  .button {
    font-size: 13px;
    padding: 4px 10px;
    float: none;
  }
  p {
    color: #555;
    font-size: 10px;
    margin: 0 0 15px 0;
    text-align: right;
    a {
      padding: 3px 3px 2px 3px;
      color: white;
      @include border-radiuses(0, 3px, 3px, 0);
      &.selected {
        background: #ccc;
        color: #333;
        @include box-shadow((inset 0 1px 3px rgba(0,0,0,0.6)));
      }
    }
  }
}


//------------------------------- LAYOUT
.wrap {
  padding: 10px 10px 0 10px;
}
.boxes {
  position: relative;
  height: 100%;
}
.top-boxes {
  position: relative;
}
.boxes [class^="box-"] {
  width: 32.5%;
  height: 100%;
  top: 0;
  position: absolute;
  @include transition(( // don't transition z-index
    width 0.4s ease,
    left 0.4s ease,
    box-shadow 0.4s ease
  ));
  @include border-radius(8px);
  > pre {
    position: absolute;
    background: white;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    resize: none;
    padding: 15px;
    font: 11px Monaco, Courier, MonoSpace;
  }
  &.expanded {
    z-index: 1001;
    left: 0;
    &.box-js {
      left: auto;
    }
    width: 100%;
  }
  h2:after {
    font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font-weight: 100;
    font-size: 12px;
    color: $gray-5;
    margin-left: 5px;
    position: relative;
    bottom: 1px;
    text-shadow: 0 -1px 0 black;
  }
  &.view-compiled {
    .CodeMirror-lines pre, .CodeMirror-lines pre span {
      color: $gray-3 !important;
    }
  }
}
.box-html {
  left: 0;
  &.jade {
    h2:after {
      content: " (Jade)";
    }
  }
  &.slim {
    h2:after {
      content: " (Slim)";
    }
  }
  &.haml {
    h2:after {
      content: " (HAML)";
    }
  }
  &.expanded {
    @include box-shadow((0 0 $glowSize #76daff));
  }
}
.box-css {
  left: 33.7%;
  &.scss {
    h2:after {
      content: " (SCSS)";
    }
  }
  &.sass {
    h2:after {
      content: " (SASS)";
    }
  }
  &.stylus {
    h2:after {
      content: " (Stylus)";
    }
  }
  &.less {
    h2:after {
      content: " (LESS)";
    }
  }
  &.expanded {
    @include box-shadow((0 0 $glowSize #4edb47));
  }
  .settings-row-1 {
    border-left-color: #85e5a9;
  }
  .settings-row-2 {
    border-left-color: #7bc195;
  }
  .settings-row-3 {
    border-left-color: #528e69;
  }
  .settings-row-4 {
    border-left-color: #3a644a;
  }
}
.box-js {
  left: auto;
  right: 0;
  &.coffeescript {
    h2:after {
      content: " (CoffeeScript)";
    }
  }
  &.expanded {
    @include box-shadow((0 0 $glowSize #9d59fa));
  }
  .settings-row-1 {
    border-left-color: #d7bafa;
  }
  .settings-row-2 {
    border-left-color: #bca2d9;
  }
  .settings-row-3 {
    border-left-color: #9573c0;
  }
  .settings-row-4 {
    border-left-color: #7452a0;
  }
}


// ------------------------------ SETTINGS
.powers {
  position: relative;
  z-index: 100;
  height: 30px;
  color: $gray-2;
  border: 1px solid black;
  border-bottom: 0;
  @include gradient(#3b3b3b, #323232);
  @include box-shadow((inset 0 1px 0 #454545));
  @include border-radiuses(8px, 0, 0, 8px);
  padding: 0 0 0 10px;
  h2 {
    line-height: 31px;
  }
}
.settings {
  display: none;
  position: absolute;
  right: 0;
  top: 30px;
  border-left: 1px solid $gray-9;
  width: 100%;
  max-width: 400px;
  &.open {
    display: block;
  }
  form {
    padding: 10px;
    div {
      display: inline-block;
      margin: 0 1% 2% 0;
      position: relative; 
      width: 31.5%;
      &.double {
        width: 65%;
      }
      label {
        display: inline-block;
        width: 100%;
        position: relative;
        a {
          position: absolute;
          right: 10px;
          top: 50%;
          margin-top: -6px;
          text-align: center;
          font-size: 11px;
          width: 15px;
          height: 15px;
          line-height: 15px;
          @include border-radius(15px);
          background: $gray-2;
          color: white;
          &:hover {
            background: $gray-5;
            @include box-shadow((0 0 8px $gray-8));
          }
        }
        small {
          
        }
      }
      &.half {
        width: 48.3%;
      }
      &.full {
        width: 100%;
      }
    }
    &.halfsies {
      div {
        width: 48.5%;
      }
    }
  }
  input[type=radio].hidden {
    display: none;
  }
  input[type=radio].hidden:checked + label {
    background: $gray-5;
  }
}

.settings-row-1 {
  background: $settingsPanelBG;
  border-left: 10px solid #9ad8ea;
  padding-bottom: 0 !important;
}
.settings-row-2 {
  background: #d2d2d2;
  border-left: 10px solid #7ab1c1;
}
.settings-row-3 {
  background: #b3b3b3;
  border-left: 10px solid #628690;
}
.settings-row-4 {
  background: #a2a2a3;
  border-left: 10px solid #355d79;
}

.inline-q {
  text-align: center;
  font-size: 11px;
  width: 15px;
  display: inline-block;
  height: 15px;
  line-height: 15px;
  @include border-radius(15px);
  background: #999;
  color: white;
}

.settings-nub, .expander {
  position: absolute;
  bottom: 0;
  right: 0;
  z-index: 1;
  text-align: center;
  display: inline-block;
  height: 30px;
  span {
    height: 30px; 
    line-height: 32px;
    padding: 0 8px;
    display: inline-block;
    color: $gray-3;
    vertical-align: middle;
    @include border-radiuses(0, 0, 8px, 0);
    @include transition((all 0.2s ease));
    @include rotate(0);
  }
  &.open span {
    @include rotate(180);
    background: $settingsPanelBG;
    color: black;
    line-height: 24px;
    margin-right: -1px;
  }
}
.expander {
  right: 40px;
  bottom: -5px;
  border-left: 0;
  strong {
    color: $gray-3;
    font-size: 13px;
    @include font-stack-bold;
    text-shadow: 0 -1px 1px black;
    .expanded & {
      display: none;
    }
  }
}
.settings-nub:before {
  content: "";
  position: absolute;
  left: 0;
  width: 1px;
  top: 1px;
  height: 29px;
  background: black;
  border-right: 1px solid $gray-6;
}
.expanded .expander {
  &:before {
    content: "(ESC) ";
    text-shadow: 0 -1px 0 black;
    background: none;
    font-size: 10px;
    font-weight: 700;
    color: $gray-1;
    margin-right: 2px;
    position: relative;
    top: -2px;
  }
  span {
    background: white;
    color: black;
  }
}   

.code-wrap {
  overflow: hidden; // WHY U NO WORK
  // height: 50px;
}


//-------------------------------------RESULTS AREA
.vert-resizer {
  @include gradient(#505050, #383838);
  border-top: 1px solid black;
  border-bottom: 1px solid black;
  @include box-shadow((
    inset 0 1px 0 #6e6e6e,
    0 2px 2px rgba(0,0,0,0.4)
  ));
  position: absolute;
  z-index: 250;
  left: 0;
  top: 50%;
  width: 100%; 
  height: 17px;
  margin-top: 1px;
  cursor: row-resize;
  span { // lazily putting a span here cuz I'd rather not deal with multiple backgrounds
    display: block;
    height: 100%;
    background: url(/images/handle.png) center center no-repeat;
  }
}

.result {
  clear: both;
  position: absolute;
  bottom: 0;
  left: -10px;
  width: 100%;
  z-index: 200; // stay above expanded tops
  iframe {
    border: 0;
    background: white;
    width: 100%;
    height: 100%;
  }
}

#drag-cover {
  position: absolute;
  z-index: 201;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  display: none;
}





//------------------------------------- FOOTER
footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 0 10px;
  height: 30px;
  line-height: 30px;
  font-size: 12px;
  color: $gray-1;
  @include gradient(#505050, #383838);
  border-top: 1px solid black;
  border-bottom: 1px solid black;
  @include box-shadow((
    inset 0 1px 0 #6e6e6e,
    0 2px 2px rgba(0,0,0,0.4)
  ));
  z-index: 300;
  a {
    color: $gray-1;
    text-decoration: underline;
  }
}
.footer-right {
  position: absolute;
  top: 0px;
  right: 10px;
}


@import "keycommands";


// Themes
// @import "../themes/codemirror";
@import "../themes/sublime";